def _input():
    result: dict[str, str] = {}
    while True:
        input_split = input("在右侧输入按空格分隔输入两项，输入其他内容以结束：").split(" ")
        if len(input_split) != 2:
            break
        result[input_split[0]] = input_split[1]
        print("已录入。")
    return result


def _search_and_print(dic: dict[str, str]):
    ending = "xxx"
    while True:
        key = input(f"请输入要查找的项，输入 '{ending}' 以结束：")
        if key == ending:
            break
        print(dic.get(key, "没有找到此项。"))


def _main():
    print("请先按提示录入姓名和手机号。")
    dic = _input()
    print("输入完成，现在可以开始查询。")
    _search_and_print(dic)
    print("程序运行完毕。")


if __name__ == "__main__":
    _main()
